// packageB/components/usually_block/package/package.js
const mybehavior = require("../../../../behaviors/requests")
Component({
  /**
   * 组件的属性列表
   */
  behaviors: [mybehavior],
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    active: 0,
    daiban_num: "",
    baseUrl: "https://logisticsengineering.gree.com/package_integrated_api",
    show1: true,
    show2: true,
    // 郑楚鑫从头部迁移过来
    self_info_show: false,
    self_info_show2: false,
    show: false,
    user_name: "",
    login_out_show: false,
    _id: "",
    company: "",
    name: "",
    ID_number: "",
    manager: "",
    phone_num: "",
    role: "",
    data_auth: "",
    self_info: {},
    yam_btn_disabled: false,
    yam_btn: "primary",
    yam_word: "发送",
    count: 0,
    new_ver_code: "",
    new_phonenum: "",
    new_name: "",
    new_ID_number: "",
    daiban_num: "",
    company_auth_count: "",
    container_auth_count: "",
    container_outdoor_count: "",
    people_auth_count: "",
    supply_register_count: "",
    third_register_count: "",
    select_style: "width: 136rpx;height: 48rpx;background: #5555FF;border-radius: 24rpx 24rpx 24rpx 24rpx;opacity: 1;position: absolute;top: 108rpx;left: 28rpx;",
    tag_style1: "position: absolute;top: 114rpx;left: 48rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;color:white;",
    tag_style2: "position: absolute;top: 114rpx;left: 196rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;",
    tag_style3: "position: absolute;top: 114rpx;left: 344rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;",
    tag_style4: "position: absolute;top: 114rpx;left: 492rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;",
    show11: true,
    show22: false,
    show33: false,
    show44: false,
    sqd_total: 0
  },
  attached: function () {
    this.getBaseDate()
    this.Submit()

  },
  /**
   * 组件的方法列表
   */
  methods: {
    // 申请单查验
    Submit() {
      var url = "https://logisticsengineering.gree.com/package_integrated_api/safety_inspect_manage/query_outdoor_orders"
      var data = {
        vehicle_num: "",
        phone_num: "",
        page_size: 1,
        page: 1,
      }
      this.post(url, data).then(res => {
        console.log("返回结果", res)
        if (res.code == 20000) {
          this.setData({

            sqd_total: res.data.total,

          })

        } else {
          console.log(err.msg);

          // wx.showToast({
          //   title: res.msg,
          //   icon: "error"
          // })
        }
      }).catch(err => {
        console.log(err.msg);

        // wx.showToast({
        //   title: err.msg,
        //   icon: 'error'
        // })
      })
    },
    // 标签切换
    tagChange1() {

      this.setData({
        show11: true,
        show22: false,
        show33: false,
        show44: false,
        tag_style1: "position: absolute;top: 114rpx;left: 48rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;color:white;",
        tag_style2: "position: absolute;top: 114rpx;left: 196rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;",
        tag_style3: "position: absolute;top: 114rpx;left: 344rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;",
        tag_style4: "position: absolute;top: 114rpx;left: 492rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;",
        tag_style3: "position: absolute;top: 114rpx;left: 344rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;",
        tag_style4: "position: absolute;top: 114rpx;left: 492rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;",
        select_style: "width: 136rpx;height: 48rpx;background: #5555FF;border-radius: 24rpx 24rpx 24rpx 24rpx;opacity: 1;position: absolute;top: 108rpx;left: 28rpx;",
      })
    },
    tagChange2() {
      this.setData({
        show11: false,
        show22: true,
        show33: false,
        show44: false,
        tag_style1: "position: absolute;top: 114rpx;left: 48rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;color: #666666;;",
        tag_style2: "position: absolute;top: 114rpx;left: 196rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;color:white;",
        tag_style3: "position: absolute;top: 114rpx;left: 344rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;",
        tag_style4: "position: absolute;top: 114rpx;left: 492rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;",
        select_style: "width: 136rpx;height: 48rpx;background: #5555FF;border-radius: 24rpx 24rpx 24rpx 24rpx;opacity: 1;position: absolute;top: 108rpx;left: 176rpx;",

      })
    },
    tagChange3() {
      this.setData({
        show11: false,
        show22: false,
        show33: true,
        show44: false,
        tag_style1: "position: absolute;top: 114rpx;left: 48rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;",
        tag_style2: "position: absolute;top: 114rpx;left: 196rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;",
        tag_style3: "position: absolute;top: 114rpx;left: 344rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;color:white;",
        tag_style4: "position: absolute;top: 114rpx;left: 492rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;",
        select_style: "width: 136rpx;height: 48rpx;background: #5555FF;border-radius: 24rpx 24rpx 24rpx 24rpx;opacity: 1;position: absolute;top: 108rpx;left: 324rpx;",
      })
    },
    tagChange4() {
      wx.navigateTo({
        url: '/packageB/pages/package/package_kanban/kanban',
      })
      this.setData({
        show11: false,
        show22: false,
        show33: false,
        show44: true,
        tag_style1: "position: absolute;top: 114rpx;left: 48rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;",
        tag_style2: "position: absolute;top: 114rpx;left: 196rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;",
        tag_style3: "position: absolute;top: 114rpx;left: 344rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;",
        tag_style4: "position: absolute;top: 114rpx;left: 492rpx;width: 96rpx;height: 36rpx;font-size: 24rpx;font-weight: 600;color: #666666;line-height: 36rpx;color:white;",
        select_style: "width: 136rpx;height: 48rpx;background: #5555FF;border-radius: 24rpx 24rpx 24rpx 24rpx;opacity: 1;position: absolute;top: 108rpx;left: 472rpx;",
      })
    },
    // 获取待办数量
    getBaseDate() {
      var url = this.data.baseUrl + "/badge_manage/query_badge_count";
      var data = {}
      this.post(url, data).then(res => {
        console.log("获取待办数量", res)
        this.setData({
          daiban_num: res.data.total_count,
          company_auth_count: res.data.company_auth_count,
          container_auth_count: res.data.container_auth_count,
          container_outdoor_count: res.data.container_outdoor_count,
          people_auth_count: res.data.people_auth_count,
          supply_register_count: res.data.supply_register_count,
          third_register_count: res.data.third_register_count,
        })

      }).catch(err => {
        console.log(err.msg);
        // wx.showToast({
        //   title: err.msg,
        //   icon: 'error'
        // })
      })
    },
    routeJump(e) {
      this.checkAuth(e)
  
    },
    // 获取待办数量
    // getBaseDate() {
    //   var url = this.data.baseUrl + "/badge_manage/query_badge_count";
    //   var data = {}
    //   this.post(url, data).then(res => {
    //     this.setData({
    //       daiban_num: res.data.total_count
    //     })

    //   }).catch(err => {
    //     wx.showToast({
    //       title: err.msg,
    //       icon: 'error'
    //     })
    //   })
    // },
    // 切换页面
    changePage(ev) {

      wx.navigateTo({
        url: ev.currentTarget.dataset.url,
      })
    },

    onChange(event) {
      wx.showToast({
        title: `切换到标签 ${event.detail.name}`,
        icon: 'none',
      });
    },
  }
})
